'''
列表的切片
'''


list = ["A","B",'C',"D"]

print("list[-1]: ",list[-1]);

print("list[0:3] : ",list[0:3])
print("list[2:3] : ",list[2:3])
print("list[2:] : ",list[2:])
print("list[0:4] : ",list[0:4])
print("list[0:4:1] : ",list[0:4:1])
print("list[0:4:2] : ",list[0:4:2])  #2 步长

print("list[-3：-1] : ",list[-3:-1])
# print("list[-1：-3] : ",list[-1:-3])

# 利用切面改变列表的长度内容
aList = [3,5,7]
aList[len(aList):] = [9]               #在尾部追加元素
print(aList)
aList[:3] = [1, 2, 3]                  #替换前3个元素
print(aList)
aList[:3] = []                         #删除前3个元素
print(aList)

# 对象的判断
aList = [3, 5, 7]
bList = aList
print("aList is bList " ,aList is bList )
cList = [3,5,7]
print("aList is cList " ,aList is cList ) # False

# //判断值是否一致
print("aList == cList : ",aList == cList)


print("id(aList)  : ",id(aList))
print("id(bList)  : ",id(bList))
print("id(cList)  : ",id(cList))





